{% load wenlincms_tags comment_tags %}

<div id="comments">
    <ul class="am-comments-list am-comments-list-flip">
        <li class="am-comment">
            <a>
                {% nevercache %}{% spaceless %}
                    {% load wenlincms_tags wlcore_tags %}
                    {% if request.user.u_profile.avatar %}
                        <img src="{{ MEDIA_URL }}{% thumbnail request.user.u_profile.avatar 52 52 %}"
                             class="am-comment-avatar" width="48">
                    {% else %}
                        <img src="{{ STATIC_URL }}" class="am-comment-avatar" width="48">
                    {% endif %}
                {% endspaceless %}{% endnevercache %}
            </a>

            <div class="media-body am-comment-main" style="margin-right:10px;border: 0">
                <header class="media-heading am-comment-hd">
                    <div class="am-comment-meta">
                        {% nevercache %}{% spaceless %}
                            {% if request.user.u_profile and request.user.u_profile.title %}
                                {{ request.user.u_profile.title }}
                                {% if request.user.u_profile.audit_status == 1 %}
                                    <img src="{{ STATIC_URL }}wltheme/img/v.gif" class="vimg" alt="数宇科技认证用户"
                                         width="12px"
                                         height="12px"/>
                                {% endif %}
                                &nbsp;{{ request.user.u_profile.unit_title }}
                            {% elif request.user.username %}
                                {{ request.user.username }}
                            {% else %}游客（发表评论请登录）{% endif %}
                        {% endspaceless %}{% endnevercache %}
                    </div>
                </header>
                <form method="post" id="comment" action="{{ comment_url }}#comment">
                    {% if not request.POST.replied_to %}
                        {% fields_for posted_comment_form %}
                    {% else %}
                        {% fields_for unposted_comment_form %}
                    {% endif %}
                    <div class="form-actions">
                        {% nevercache %}{% spaceless %}
                            {% if request.user.is_authenticated %}
                                <button type="submit" class="am-btn am-btn-secondary am-btn-xs" id="send_comment"
                                        guest="0">
                                    <span class="am-icon-comment-o"></span> 发表
                                </button>
                            {% else %}
                                <a class="am-btn am-btn-secondary am-btn-xs" id="send_comment" guest="1"
                                   href="{% url "login" %}?next={{ request.path }}#comment">
                                    <span class="am-icon-eject moveicon-4"></span> 登录
                                </a>
                                &nbsp;&nbsp;
                                <a class="am-btn am-btn-success am-btn-xs" id="send_comment" guest="1"
                                   href="{% url "signup" %}?next={{ request.path }}#comment">
                                    <span class="am-icon-sign-in moveicon-4"></span> 注册
                                </a>
                            {% endif %}
                            <span style="float: left;color: #999;margin-top:15px">请勿发表含有广告性质和联系方式的内容</span>
                        {% endspaceless %}{% endnevercache %}
                    </div>
                </form>
            </div>
        </li>
    </ul>
    <br>

    <div id="comment_thread">{% wlcomment_thread object_for_comments %}</div>
</div>
